<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>数组去重</title>
</head>
<body>
  
  <script>
    let  arr =  [1, 2, 3, 2, 33, 55, 66, 3, 55];
    //1. indexOf 赋值新数组
    let newArr = [];
    arr.map(item => {
      // -1 找不到值
      if(newArr.indexOf(item) == "-1") {
        newArr.push(item)
      }
    })
    console.log(newArr)

    // 2. 直接es6 新语法 ...new Set()
    let arr2 = [... new Set(arr)]
    console.log(arr2)
    
  </script>
</body>
</html>